package ccpvspiral1;

import java.awt.geom.Point2D;

/**
 * Person defines an agent with parameters used to track characteristics of the person's character.
 * @author Robert Puckett
 *
 */
public class Person {

	public static int count = 0;
	private int id = 0;
	private int location = 0;
	private Point2D.Double position = new Point2D.Double();
    private int qty = 0;
	private int groupIndex = -1;
    
	/** Contains the ascriptive characteristics, and other parameters that define the person. */
	private int[] character;


	/**
	 * Creates a new person with no parameters or history at position (0,0).
	 */
	public Person(int[] character, int qty, int location, int groupIndex) {
		this.id = nextCount();
		this.qty = qty;
		this.location = location;
		this.groupIndex = groupIndex;
		setCharacter(character);
		setPosition(new Point2D.Double(0,0));  
	}

	public int getQty() {
		return qty;
	}
	public void setQty(int qty) {
		this.qty = qty;
	}
	private int nextCount() { 
		count++;
		return count-1;
	}
	
	public int getGroupIndex() {
		return groupIndex;
	}
	
	private void setCharacter(int[] character) {
		this.character = new int[character.length];
		for (int i = 0; i< character.length; i++) {
			this.character[i] = character[i];
		}
	}

	
	public Person(Person p) {
		this.id = nextCount();
		this.location = p.location;
		this.character = new int[p.character.length];
		for (int i = 0; i<p.character.length; i++) {
			  this.character[i] = p.character[i];
		}
	}




	/**
	 * @param position the position to set
	 */
	public void setPosition(Point2D.Double position) {
		this.position = position;
	}

	/**
	 * @return the position
	 */
	public Point2D.Double getPosition() {
		return position;
	}

	
	public int[] getCharacter() {
		return character;
	}
	
	/**
	 * @param location the location to set
	 */
	public void setLocation(int location) {
		this.location = location;
	}

	/**
	 * @return the location
	 */
	public int getLocation() {
		return location;
	}

	/**
	 * @param history the history to set
	 */
//	public void setHistory(ArrayList<Event> history) {
//		this.history = history;
//	}
	/**
	 * Adds an event to the person's history.
	 * @param evt
	 */
//	public void addEvent(Event evt) {
//		history.add(evt);
//	}

	/**
	 * @return the history
	 */
//	public ArrayList<Event> getHistory() {
//		return history;
//	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		String value = this.id + ", " + position.toString();
		//value += ", Characteristics: ";
		for (Integer char1 : character) {
			value += ", " + char1;
		}
		//value += ", History: ";
//		for (Event ev : history) {
//			value += ", " + ev.toString();
//		}
		return value;
		
	}


}


/** Stores the personal history of this person. */ 
//private ArrayList<Event> history = new ArrayList<Event>();  

/*
/**
 * Creates a person with the given set of parameters that define his character.
 * @param character A set of parameters.
 
public Person(ArrayList<Integer> character, int location) {
	this.id = count;
	this.location = location;
	count++;
	for (Integer value: character) {
	  this.character.add(value);	
	}
	
}
*/


/*
public Person(int[] character2, int location2) {
	this.id = count;
	this.location = location2;
	count++;
	for (int i = 0; i < character2.length; i++) {
		  this.character[i] = character2[i];
	}
}
*/

/*
/**
 * Adds a parameter to the character list that defines the person.
 * @param param
 
public void addCharacteristic(Integer char1) {
	this.character.add(char1);
}
*/

